<%--引用jstl--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="pojo.SysUser" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>demo1</title>
</head>
<body>
<%--在个人中心中，展示用户信息，用户头像，
如果用户没有上传头像，就使用默认头像，如果有，就使用上传的--%>
<%
request.setAttribute("imgUrl", "https://ps.ssl.qhimg.com/t01e84b1f220a3dea04.jpg");

%>

<c:if test="${empty imgUrl}">
    <img width="200px" height="200px" src="https://ps.ssl.qhimg.com/t0151945703ead8e207.jpg">
</c:if>
<c:if test="${!empty imgUrl}">
    <img width="200px" height="200px" src="${imgUrl}">
</c:if>
<%
    SysUser sysUser1 = new SysUser(1,"小郭",20);
    SysUser sysUser2 = new SysUser(2,"小李",18);
    List<SysUser> list = new ArrayList<>();
    list.add(sysUser1);
    list.add(sysUser2);
    request.setAttribute("list", list);
    for (SysUser user : list) {
//        System.out.println(user);此法得到的是地址，需要c:foreach遍历
    }
%>
<%--保存的数据集合
c:forEach:遍历   items:遍历的集合    var:遍历的结果或者是key(map) varStatus:遍历的状态
step:步幅 默认是1   begin：从哪个下标开始  end：到哪个结束
--%>
<table border="1" cellspacing="0" cellpadding="0" width="600" align="center">
    <c:forEach var="user" varStatus="status" step="1" end="${list.size()}" begin="0" items="${list}">
        <tr>
            <td>id:${user.id}</td>
            <td>name:${user.name}</td>
            <td>age:${user.age}</td>
        </tr>
    </c:forEach>
</table>
<%--url标签--%>
<c:url var="url" value="http://www.baidu.com" scope="application"></c:url>
<a href="${url}">百度</a>
<c:url var="path" value="${pageContext.request.contextPath}"></c:url>
${pageContext.request.contextPath}
<form action="${pageContext.request.contextPath}/test" method="get">
    <input type="submit">
</form>

</body>
</html>
